<template>
	<view class="selectBuild">
		<!-- 选择楼栋 -->
		<view class="content">
			<navigator @click="passMsg(v.buildingName)" hover-class="navigator-hover" open-type="navigateBack"
				v-for="v in builddata" :key="v.id">
				<view class="item">
					{{v.buildingName}}
				</view>
			</navigator>

		</view>
	</view>
</template>

<script>
	import {
		http
	} from "../../../../utils/http.js"
	export default {
		data() {
			return {
				builddata: []
			};
		},
		methods:{
			getData(){
				http({
					url:"/towerUnit/list",
					method:"get"
				}).then(({data})=>{
					console.log(data)					
					this.builddata=data
				})
			},
			// 传参
			passMsg(v){
				console.log(v,"楼栋")
				uni.navigateTo({
					url: '../addHouse?buildingName='+v
				});

			}
		},
		onLoad(){
			this.getData()
		}
	}
</script>

<style lang="less">
	.selectBuild {
		.content {
			padding: 0 9rpx;
			padding-top: 76rpx;
			display: flex;
			flex-wrap: wrap;

			.item {
				width: 204rpx;
				height: 100rpx;
				text-align: center;
				margin: 19rpx;
				line-height: 100rpx;
				border-radius: 10rpx;
				border: 1px solid #ccc;
			}
		}
	}
</style>
